/* only for speed test */
#define TEST
#define NUMBER_OF_RUNS 100
#include <sys/time.h>
#include "LandscapeModel.h"
#include <string>
#include <iostream>

int main(int argc, char **argv) {
	if (argc < 2) {
		std::cout << "You have to provide the name of the file "
				"with the parameters." << std::endl;
		return (0);
	}
	LandscapeModel model;
	if (model.initializeModel(argv[1])) {
		struct timeval time1;
		struct timeval time2;
		double sumS = 0;
		for (int i = 0; i < NUMBER_OF_RUNS; i++) {
			gettimeofday(&time1, NULL);
			model.baseDEM->evaluateHydroNet();
			gettimeofday(&time2, NULL);
			std::cout << "Iterazione " << i << ", tempo impiegato: "
					<< (time2.tv_sec - time1.tv_sec) << "."
					<< (time2.tv_usec - time1.tv_usec) << std::endl;
			sumS = sumS + (double) (time2.tv_sec - time1.tv_sec)
					+ (0.000001 * (double) (time2.tv_usec - time1.tv_usec));
		}
		std::cout << "tempo medio: " << sumS << "/" << NUMBER_OF_RUNS << " secondi."
				<< std::endl;
	}
}
